package impl.sdi.business;

import impl.sdi.business.classes.tema.*;
import impl.sdi.business.classes.tema.TemaBuscar;


import java.util.List;

import com.sdi.business.TemaService;
import com.sdi.business.exception.EntityAlreadyExistsException;
import com.sdi.business.exception.EntityNotFoundException;
import com.sdi.model.Tema;


public class SimpleTemaService implements TemaService {

	public List<Tema> getTemas() {
		return new TemasListado().getTemas();
	}

	@Override
	public void saveTema(Tema tema) throws EntityAlreadyExistsException {
		new TemaAlta().save(tema);
	}

	@Override
	public void updateTema(Tema tema) throws EntityNotFoundException {
		new TemaUpdate().update(tema);
	}

	@Override
	public void deleteTema(String name) throws EntityNotFoundException {
		new TemaBaja().delete(name);
	}

	@Override
	public Tema findByName(String name) throws EntityNotFoundException {
		return new TemaBuscar().find(name);
	}
}
